<template>
  <div class="rank">
    <nuxt-link class="item" v-for="(item,index) in rank" :to="{name:'search-key',params:{q:item}}" :key="item">
      <div :class="'flag '+(index<=2?'flag'+index:'')">{{ index+1 }}</div>
      <div class="keyword">
        {{ item }}
      </div>
    </nuxt-link>
  </div>
</template>

<script>
export default {
  name: "HotRank",
  props: {
    rank: {
      type: Array,
      default: () => []
    }
  }
}
</script>

<style scoped lang="less">
.rank {
  .item {
    display: flex;
    margin-top: 10px;
    height: 25px;
    line-height: 25px;
    .flag {
      //flex: 0;
      width: 45px;
      background-image: url("~/static/img/hotRankDefault.png");
      background-size: cover;
      text-align: center;
      color: white;
      margin-right: 10px;
      font-size: 14px;

    }

    .flag0 {
      background-image: url("~/static/img/hotRank1.png");
      padding-top: 2px;
      padding-left:3px;
    }

    .flag1 {
      background-image: url("~/static/img/hotRank2.png");
      padding-top: 2px;
      padding-left:3px;
    }

    .flag2 {
      background-image: url("~/static/img/hotRank3.png");
      padding-top: 2px;
      padding-left:3px;
    }

    .keyword {
      flex: 1;
      font-size: 13px;
      color: var(--color);
    }
  }
}
</style>
